package com.deri.egov.vor;

import org.deri.vor.R;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.widget.TextView;

public class ClickableAlertDialog {
	public static Builder create(Context context, CharSequence title, CharSequence messageText) {
		  final TextView message = new TextView(context);
		  final SpannableString s = 
		               new SpannableString(messageText);
		  Linkify.addLinks(s, Linkify.WEB_URLS);
		  message.setText(s);
		  message.setMovementMethod(LinkMovementMethod.getInstance());

		  return new AlertDialog.Builder(context)
		   .setTitle(title)
		   .setCancelable(true)
		   .setIcon(android.R.drawable.ic_dialog_info)
		   .setPositiveButton(R.string.dismiss, null)
		   .setView(message);
		 }
}
